package com.example.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("test")
@RestController
public class ReadymlController {
    @RequestMapping("hello")
    public String say(){
        return "hello";
    }

//    @Value("${mykey}")
//    private String ky;
//
//    @RequestMapping("readyml")
//    public String readYml(){
//        return "从yml中获取文件"+ ky;
//    }

    @Autowired
    private DbType dbType;
    @Autowired
    private Student student;

    @RequestMapping("readStudent")
    public String readStudent(){
        return "从yml中获取配置文件Student:" + student;
    }

    @RequestMapping("readDbType")
    public String readDbType(){
        return "从yml中获取配置文件Dbtype:" + dbType + ",size:" + dbType.getName().size();
    }

}
